<?php
class Admin_Form_AddCruise extends Apps_Form {
	public function init() {
		$dataMaper = new M_Tool_DataMapper();

		$name = new Zend_Form_Element_Text(
				'name',
				array('label'	=> 'Name (Vi)',
						'filters'		=> array('StringTrim')));

		$enName = new Zend_Form_Element_Text(
				'en_name',
				array('label'	=> 'Name (En)',
					  'required'	 => true,
						'filters'		=> array('StringTrim')));

		$tbCruise = new M_DbTable_Cruise();
		$cruise   = new Zend_Form_Element_Select(
				'parent_cruise_id',
				array('label'		 => 'Parent cruise',
					  'multiOptions' => $dataMaper->mapKeyValue($tbCruise->getList(),'id', 'en_name', array(0 => '---'))));
		
		$tbCruiseCategory = new M_DbTable_CruiseCategory();
		$cruiseCategory   = new Zend_Form_Element_Select(
				'cruise_category_id',
				array('label'		 => 'Cruise category',
					  'required'	 => true,
					  'multiOptions' => $dataMaper->mapKeyValue($tbCruiseCategory->getList(),'id', 'en_title')));

		$tbCruiseType  = new M_DbTable_CruiseType();
		$cruiseType 	  = new Zend_Form_Element_Select(
				'cruise_type_id',
				array('label'		 => 'Cruise type',
					  'required'	 => true,
					  'multiOptions' => $dataMaper->mapKeyValue($tbCruiseType->getList(),'id', 'en_title')));

		$tbCountry  = new M_DbTable_Country();
		$country    = new Zend_Form_Element_Select(
		        'country_id',
		        array('label'		 => 'Country',
		                'required'	 => true,
		                'multiOptions' => $dataMaper->mapKeyValue($tbCountry->getList(), 'id', 'en_name')));

		$description = new Zend_Form_Element_Textarea(
				'description',
				array('label' 		=> 'Description'));

		$this->addElement($cruiseCategory)
			 ->addElement($cruiseType)
			 ->addElement($cruise)
			 ->addElement($country)
			 ->addElement($enName)
			 ->addElement($name)
			 ->addElement($description);

		$this->setLegend('Add New Cruise');
		$this->addActionGroup()
			 ->makeup();
	}
}